# Maintainer: David Runge <dvzrv@archlinux.org>

_name=mergedict
pkgname=python-mergedict
pkgver=1.0.0
pkgrel=7
pkgdesc="A Python dict with a merge() method"
arch=('any')
url="https://github.com/schettino72/mergedict/"
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('0f9f619961d2840995d2c2498debcf8b47c54fae76f419588562311d5bc43483c994cbeb618f2a1220a9ab33c56f12e3e257323c40ecd0db3a7181d7dd80ef27')
b2sums=('6ec3a5df1b9c366cbb8b87b4c02ff18f15953d1e10469c5d20e170f0a1deca949edab6f0bd0100fb085401375cce51b9e323279d296153144548b93a8d072e7e')

prepare() {
  mv -v "$_name-$pkgver" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
                          --optimize=1 \
                          --root="${pkgdir}"
  install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -vDm 644 {CHANGES,README.rst} -t "${pkgdir}/usr/share/doc/${pkgname}"
}
